/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package multiface.promonet.jpa;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author diego
 */
@Entity
@Table(name = "report")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Report.findAll", query = "SELECT r FROM Report r"),
    @NamedQuery(name = "Report.findByIdreport", query = "SELECT r FROM Report r WHERE r.idreport = :idreport"),
    @NamedQuery(name = "Report.findByData", query = "SELECT r FROM Report r WHERE r.data = :data"),
    @NamedQuery(name = "Report.findByStato", query = "SELECT r FROM Report r WHERE r.stato = :stato"),
    @NamedQuery(name = "Report.findByReport", query = "SELECT r FROM Report r WHERE r.report = :report")})
public class Report implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idreport")
    private Integer idreport;
    @Basic(optional = false)
    @Column(name = "data")
    @Temporal(TemporalType.TIMESTAMP)
    private Date data;
    @Basic(optional = false)
    @Column(name = "stato")
    private String stato;
    @Column(name = "report")
    private Boolean report;
    @OneToMany(mappedBy = "report")
    private List<Lavoro> lavoroList;
    @OneToMany(mappedBy = "report")
    private List<File> fileList;
    @JoinColumn(name = "puntovendita", referencedColumnName = "idpuntovendita")
    @ManyToOne(optional = false)
    private Puntovendita puntovendita;
    @JoinColumn(name = "promozione", referencedColumnName = "idpromozione")
    @ManyToOne(optional = false)
    private Promozione promozione;
    @OneToMany(mappedBy = "report")
    private List<RigaProdottoReport> rigaProdottoReportList;

    public Report() {
    }

    public Report(Integer idreport) {
        this.idreport = idreport;
    }

    public Report(Integer idreport, Date data, String stato) {
        this.idreport = idreport;
        this.data = data;
        this.stato = stato;
    }

    public Integer getIdreport() {
        return idreport;
    }

    public void setIdreport(Integer idreport) {
        this.idreport = idreport;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public String getStato() {
        return stato;
    }

    public void setStato(String stato) {
        this.stato = stato;
    }

    public Boolean getReport() {
        return report;
    }

    public void setReport(Boolean report) {
        this.report = report;
    }

    @XmlTransient
    public List<Lavoro> getLavoroList() {
        return lavoroList;
    }

    public void setLavoroList(List<Lavoro> lavoroList) {
        this.lavoroList = lavoroList;
    }

    @XmlTransient
    public List<File> getFileList() {
        return fileList;
    }

    public void setFileList(List<File> fileList) {
        this.fileList = fileList;
    }

    public Puntovendita getPuntovendita() {
        return puntovendita;
    }

    public void setPuntovendita(Puntovendita puntovendita) {
        this.puntovendita = puntovendita;
    }

    public Promozione getPromozione() {
        return promozione;
    }

    public void setPromozione(Promozione promozione) {
        this.promozione = promozione;
    }

    @XmlTransient
    public List<RigaProdottoReport> getRigaProdottoReportList() {
        return rigaProdottoReportList;
    }

    public void setRigaProdottoReportList(List<RigaProdottoReport> rigaProdottoReportList) {
        this.rigaProdottoReportList = rigaProdottoReportList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idreport != null ? idreport.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Report)) {
            return false;
        }
        Report other = (Report) object;
        if ((this.idreport == null && other.idreport != null) || (this.idreport != null && !this.idreport.equals(other.idreport))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "multiface.promonet.jpa.Report[ idreport=" + idreport + " ]";
    }
    
}
